﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BussinessLogicTecnoPez.Produccion.Enfermedades_y_control_de_estanques;
using BussinessLogicTecnoPez.Produccion.Clasificacion_e_Incubacion;
using BussinessLogicTecnoPez.Seguridad_Tecnopez;
using BussinessLogicTecnoPez;

public partial class GrillaTest : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        TecnoPezDataGrid1.setupGrid(typeof(FuncionTecnopez),cargarGrilla,false, true, ViewState);
        TecnoPezDataGrid2.setupGrid(typeof(FuncionTecnopez), cargarGrilla2, false, true, ViewState);
    }

    
    
    private void cargarGrilla()
    {
       
        //Especie.getManager.AddFilter("NOMBRE", GenericManager<Especie>.filterOperator.Like, "%" + txtBuscarNombre.Text.Trim() + "%");

        FuncionTecnopez.getManager.ClearFilters();
        FuncionTecnopez.getManager.ClearOrders();

        if (TecnoPezDataGrid1.getPageDataViewOrderKeyValue(ViewState) == null)
        {
            FuncionTecnopez.getManager.AddOrder("IdFuncionTecnopez", GenericManager<FuncionTecnopez>.Order.orderDirection.DESC);
        }
        else
        {
            FuncionTecnopez.getManager.AddOrder(TecnoPezDataGrid1.getPageDataViewOrderKeyValue(ViewState), TecnoPezDataGrid1.getPageDataViewOrdenDireccionKeyValue<FuncionTecnopez>(ViewState));
        }


    
        List<FuncionTecnopez> lista = new List<FuncionTecnopez>();
        lista = FuncionTecnopez.getManager.GetFilter();
        TecnoPezDataGrid1.DataSource = lista;
        TecnoPezDataGrid1.DataBind();


    }

    private void cargarGrilla2()
    {

        //Especie.getManager.AddFilter("NOMBRE", GenericManager<Especie>.filterOperator.Like, "%" + txtBuscarNombre.Text.Trim() + "%");

        FuncionTecnopez.getManager.ClearFilters();
        FuncionTecnopez.getManager.ClearOrders();

        if (TecnoPezDataGrid1.getPageDataViewOrderKeyValue(ViewState) == null)
        {
            FuncionTecnopez.getManager.AddOrder("IdFuncionTecnopez", GenericManager<FuncionTecnopez>.Order.orderDirection.DESC);
        }
        else
        {
            FuncionTecnopez.getManager.AddOrder(TecnoPezDataGrid1.getPageDataViewOrderKeyValue(ViewState), TecnoPezDataGrid1.getPageDataViewOrdenDireccionKeyValue<FuncionTecnopez>(ViewState));
        }



        List<FuncionTecnopez> lista = new List<FuncionTecnopez>();
        lista = FuncionTecnopez.getManager.GetFilter();
        TecnoPezDataGrid2.DataSource = lista;
        TecnoPezDataGrid2.DataBind();


    }
}
